#include<iostream>
#include<vector>
using namespace std;

 int check(int n){
  int ans=0;
  int b=0;
  bool l=0;
  for(int z=1;z<=n;z++){
    int a=b;
    cin >>b;
    if(b<a) {l=1;}
    if(b>a&&l==1) {ans++;l=0;}
    a=b;
  }
  return ans;
}


int main(){
  int n;
  cin>>n;
  cout<<check(n);
}